#ifndef _AME_PACKETS_H_
#define _AME_PACKETS_H_

#define EMPTY_PACKET {PacketUnknown, 0, 0, 0, 2, netParserFinishPacket}

typedef struct packets {
	enum {
		PacketChatSystem = 0, // 00
		PacketChatNotice, // 01
		PacketChat, // 02
		PacketChatShout, // 03
		PacketChatPM, // 04
		PacketChatTrade,
		PacketChatParty,
		PacketChatGuild,
		PacketAuthRequest = 10,
		PacketAuthSuccess,
		PacketAuthDeny,
		PacketKick,
		PacketObjectLocated = 20,
		PacketObjectMovement,
		PacketObjectTrajectoryChange,
		PacketObjectDisappeared,
		PacketLookAroundRequest,
		PacketCharselectCountRequest = 30,
		PacketCharInfoRequest,
		PacketCharselectRequest,
		PacketCharSelectedOK,
		PacketCharSelectedFailure,
		PacketMoveChar	= 40,
		PacketWhois = 50,
		PacketMoveRequest,
		PacketUnknown
	} packet;
	char code;
	char sub_code;
	unsigned arguments: 4;
	unsigned length: 32; // In bytes
	int (*proc)(struct client *);
} NetPackets;

#define PACKET_NUM(header) (*(unsigned short *)header)

int netParserClientChat(struct client *me);
int netParserClientPMChat(struct client *me);
int netParserClientPartyChat(struct client *me);
int netParserClientGuildChat(struct client *me);
int netParserClientLogin(struct client *me);
int netParserCharMovement(struct client *me);
int netParserCharselectCount(struct client *me);
int netParserCharselectInfo(struct client *me);
int netParserCharselect(struct client *me);
int netParserFinishPacket(struct client *me);
int netParserCharMapInfo(struct client *me);
int netParserLookAroundReq (struct client *me);
int netParserWhois(struct client *me);
int netParserKick(struct client *me);
int netParserLogout(struct client *me);

#endif
